# -*- coding:utf-8 -*-
# Create your tasks here
from celery import shared_task
from Main.celery_main import app
# celery的任务必须写在tasks.py的文件中，别的文件名称不识别!!!
# from Main.celery_main import app
import time

import logging

log = logging.getLogger('django')


@app.task
def add(x, y):
    log.info("start" + str(time.time()))
    time.sleep(10)
    log.info("end" + str(time.time()))
    return x + y

# @shared_task 装饰器能让我们避免对某个项目名对应Celery实例的依赖
@shared_task
def mul(x, y):
    return x * y
